<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="天地图山东" />
    <title>天地图山东地图API－示例－面点击事件</title>
    <link type="text/css" rel="stylesheet" href="http://59.206.203.34/api/agsapi/javascript/js/esri/css/esri.css" />
    <script type="text/javascript" src="http://59.206.203.34/api/agsapi/javascript/js/init.js"></script>
    <script type="text/javascript">
        // 测试上传
        //定义地图对象
        var map;
        //引入天地图山东矢量图层
        require(["esri/map", "tdlib/SDTDTLayer", "esri/geometry/Extent", "esri/geometry/Polygon",
         "esri/SpatialReference", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/graphic", "dojo/domReady!"],
    function (Map, SDTDTLayer, Extent, Polygon, SpatialReference, SimpleLineSymbol, SimpleFillSymbol, Graphic) {
        map = new Map("mapDiv",
         {
             logo: false,
             slider: false,
             nav: false,
             extent: new Extent({ xmin: 116.5, ymin: 36.2, xmax: 117.5, ymax: 37.2, spatialReference: { wkid: 4490} })
         });
        //图层初始化
        var sdvecLayer = new SDTDTLayer();
        //添加图层到地图
        map.addLayer(sdvecLayer);
        var myPolygon = { "geometry": {
            "rings": [[[117.112, 36.53], [117.512, 36.53], [117.212, 36.83], [117.112, 36.83], [117.112, 36.53]]],
            "spatialReference": { "wkid": 4490 }
        },
            "symbol": { "color": [0, 0, 0, 64], "outline": { "color": [0, 0, 0, 255],
                "width": 1, "type": "esriSLS", "style": "esriSLSSolid"
            },
                "type": "esriSFS", "style": "esriSFSSolid"
            }
        };
        var graphic = new Graphic(myPolygon);
        map.graphics.add(graphic);

        document.getElementById("addClick").onclick = function () {
            handler = map.graphics.on("click", clickHandler)
        }
        document.getElementById("removeClick").onclick = function () {
            handler.remove();
        }
        function clickHandler(evt) {
            alert("您点击了面");
        };
    }
    );
    </script>
</head>
<body>
        <div id="mapDiv" style="position:absolute;width:600px; height:500px">
        </div>
        <div style="position:absolute;left:650px;">
            面点击事件：<br />
            <input type="button" id="addClick" value="注册" />
            <input type="button" id="removeClick" value="移除" />
        <p><a href="http://59.206.203.34/api/agsapi/examples.html">返回所有范例列表</a></p>
    </div>
</body>
</html>
